<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <#include "/common/base.html" >
</head>
<body>
    Hello World Ecpss
<div style="width:400px;border: 1px solid gray;" id="con1">
</div><br>
<div style="width:400px;border: 1px solid gray;" id="con2">
</div><br>
<div style="width:400px;border: 1px solid gray;" id="con3">
</div>
</body>
<script type="text/html" id="test1">
    template()的用法<br>
    <div>
        <h3>你好，我的名字是：{{name1}}</h3>
        <h3>你好，我的名字是：{{name2}}</h3>
        <h3>你好，我的名字是：{{name3}}</h3>
    </div>
</script>
<script type="text/javascript">
    var value = {
        name1: 'Tom',
        name2: 'Lucy',
        name3: 'Lily'
    };
    function test1(){
        var html = template('test1', value);
        document.getElementById('con1').innerHTML = html;
    }
    function test2(){//compile
        var source = 'compile()的用法，<br>你好，我是Jack，我今年<b>{{age}}</b>岁了';
        var render = template.compile(source);
        var html = render({age: 21});
        document.getElementById('con2').innerHTML = html;
    }
    function test3(){
        var source = 'render()的用法，<br>你好，我是<b>{{name}}</b>，我今年<b>{{age}}</b>岁了,今年我要挣大钱';
        var html = template.render(source, {name: '宋卫兴', age: 29});
        document.getElementById('con3').innerHTML = html;
    }
</script>
<script type="text/javascript">
    test1();
    test2();
    test3();
</script>


</html>